package main

import (
	"fmt"
	"strconv"
	"git.oschina.net/xiaoqiaotq/hello-go/cmdb"
	"bytes"
)
type AA interface {
	doSomeThing() string
}

type T struct {
    a int
	b string
	int
	Inner
}
func (_ *T)doSomeThing() string  {
	return "21"
}

func (_ *T)method1() string  {
	return "21"
}

func func1()  {
	fmt.Println("func1")
}

type Inner struct {
	a int
    innerB int
}
func main() {
	func11:= func1
	func11()
    classifier(func11)
	var aa AA

	tt1:=T{1,"2",11,Inner{2,3}}
	aa=&tt1
	fmt.Println(aa)
	fmt.Println(tt1)
	fmt.Println(&tt1)
	fmt.Println(strconv.Itoa(tt1.a))
	fmt.Println((&tt1).a)
	fmt.Println(tt1.method1())
	fmt.Println(tt1.innerB)
	fmt.Println("=================")

	t := new(T)
	t.a=2
	t.b="afs"
	t.int=21
	t.a=3
	fmt.Println(t)
	fmt.Printf("aaa %#v \n",t)
	fmt.Printf("aaa %T \n",t)
	fmt.Println("=================")

	var c *T
	fmt.Println(c)
	c=new(T)
	fmt.Println(c)
	fmt.Println(&*c)
	fmt.Println(*c)
	fmt.Println("=================")

	type toy T
	var ccc *toy
	fmt.Println(ccc)

	var aadd cmdb.ServerDTO
	ss:= &cmdb.ServerDTO{}
	fmt.Println(aadd.Id)
	fmt.Println(ss)
}

func classifier(items ...interface{}) {
	for i, x := range items {
		switch x.(type) {
		case bool:
			fmt.Printf("Param #%d is a bool\n", i)
		case float64:
			fmt.Printf("Param #%d is a float64\n", i)
		case int, int64:
			fmt.Printf("Param #%d is a int\n", i)
		case nil:
			fmt.Printf("Param #%d is a nil\n", i)
		case string:
			fmt.Printf("Param #%d is a string\n", i)
		default:
			fmt.Printf("Param #%d is unknown\n", i)
		}
	}
}

type afsdasfasdf interface {}
